package unit04.day02;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 使用文件流复制文件
 * @author cola
 *
 */
public class CopyDemo1 {

	public static void main(String[] args) throws IOException {
//		File file = new File("fos.txt");
//		long size = file.length();
//		byte[] data = new byte[(int) size];
		FileInputStream fis = new FileInputStream("fos.txt");
		FileOutputStream fos = new FileOutputStream("fis.txt");
//		fis.read(data);
//		fos.write(data);
		byte[] buf = new byte[1];
		int len = -1;
		while((len = fis.read(buf)) != -1) {
			fos.write(buf,0,len);
		}
		fis.close();
		fos.close();
	}
}
